<?
require("config.php");

$Query = "SELECT 
code,date,

name,last_name,email,
tel, fax, address, profession, education, country, lang_english, lang_dannish, lang_chinese
FROM $table";

$r=myQuery($Query);


header("Content-type:application/vnd.ms-excel;charset=iso0-8859-1");  
header("Content-Disposition:filename=subscription_" . date("Ymd") . ".xls");  

echo "code\t"; 
echo "subscription date\t";
echo "name\t";echo "last_name\t";echo "email\t"; echo "tel\t"; echo "fax\t";echo "address\t";

echo "profession\t"; 
echo "education\t"; 
echo "country\t";
echo "Language - English\t";echo "Language - Danish\t";
echo "Language - Chinese\t\n";

for ($i=0;$i<count($r);$i++){

echo $r[$i][0] . "\t"; 
echo $r[$i][1] . "\t"; 
echo $r[$i][2] . "\t"; 
echo $r[$i][3] . "\t"; 
echo $r[$i][4] . "\t"; 
echo $r[$i][5] . "\t"; 
str_replace("\t"," ",str_replace("\n"," ",str_replace("\r"," ",$r[$i][6])))."\t";
echo $r[$i][7] . "\t"; 
echo $r[$i][8] . "\t"; 
echo $r[$i][9] . "\t"; 
echo $r[$i][10] . "\t"; 
echo $r[$i][11] . "\t"; 
echo $r[$i][12] . "\t";  
echo $r[$i][13] . "\t\n"; 
}
?>